import HttpRequest from '@/libs/axios'
import config from '@/config'

let baseUrl = config.baseUrl.dev
if (process.env.VUE_APP_ENV) {
  baseUrl =
    process.nextTick.VUE_APP_ENV === 'test'
      ? config.baseUrl.test
      : config.baseUrl.prod
}

const timeout = 30000
const httpRequest = new HttpRequest(baseUrl, timeout)
export default (options) => {
  console.log(options)
  options.body = options.data
    ? { ...config.data, ...options.data }
    : { ...config.data }
  delete options.data
  const baseHeader = {
    c_name: 'wangbuhan',
    c_year: '356',
    version: '3.1.8',
    appsystem: 'kuaiyingyong',
    os: 0,
  }
  options.headers = Object.assign({}, baseHeader, options.headers)
  console.log(`啊啊啊啊啊啊啊啊啊啊`)
  return httpRequest.request(options)
}
